/*
 * Copyright (C) by Fluid Operations.
 * All rights reserved.
 *
 * For more information go to http://www.fluidops.com
 */

package com.fluidops.util.help;

import java.io.File;

import sun.reflect.generics.reflectiveObjects.NotImplementedException;

import com.fluidops.util.FileHelper;

/**
 * @author stefan
 *
 */
public class HelpContent
{
	// title of the help
	public String title;
	// the TOC
	public TOCItem[] toc;
	// the index
	public IndexItem[] index;
	// the list of files;
	public String[] content;
	public String config;
	public String basePath;
	
	public HelpContent(HelpContent in)
	{
		title = in.title;
		toc = in.toc;
		index = in.index;
		content = in.content;
		basePath = in.basePath;
	}
	
	public HelpContent()
	{}
	
	public void parse(String configFile) throws Exception
	{
		throw new NotImplementedException();
	}

	public void write(String confFile) throws Exception
	{
		config = confFile;
		File configFile = new File(confFile);
		String newBasePath = configFile.getParent() + File.separator;

		// if everything has been moved to a new location, first copy the content over
		if(newBasePath != basePath)
			FileHelper.copyFiles(content, basePath, newBasePath);
		basePath = newBasePath;
	}
}
